@using System.Text.RegularExpressions
@model ZKEACMS.Shop.ViewModel.BasketData
@{
    Layout = null;
}
<div class="basket">
    <div class="basket-header clearfix">
        <div class="pull-left">
            <h4>@L("购物车")</h4>
        </div>
        <button type="button" class="close" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    </div>
    <div class="basket-body">     
        <ul class="container-fluid">
            @if (Model.Basket != null)
            {
                foreach (var item in Model.Basket)
                {
                    <li id="basket-@item.ID" class="row basket-item" data-id="@item.ID">
                        <div class="col-xs-4">
                            <img src="@Url.PathContent(item.ImageUrl)" />
                        </div>
                        <div class="col-xs-8">
                            <h5>@item.Title</h5>
                            <div class="tag">
                                @item.Description
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <div class="col-xs-4">
                            <div class="row text-center quantity-set">
                                <a href="javascript:" class="quantity-minus glyphicon glyphicon-minus-sign"></a>
                                <span class="quantity">@item.Quantity</span>
                                <a href="javascript:" class="quantity-plus glyphicon glyphicon-plus-sign"></a>
                            </div>
                        </div>
                        <div class="col-xs-8">
                            <div class="clearfix">
                                <div class="text-right">
                                    <span class="price">
                                        @L("￥")
                                        @Html.Raw(Regex.Replace(item.Price.ToString("F2"), @"\.(\d+)", "<small>.$1</small>"))
                                        x <span class="quantity">@item.Quantity</span>
                                    </span>
                                    <a href="javascript:" class="remove glyphicon glyphicon-trash"></a>
                                </div>
                            </div>
                        </div>
                    </li>
                }

            }
            @if (Model.Basket == null || !Model.Basket.Any())
            {
                <li class="row empty text-center">
                    @L("您的购物车是空的")
                </li>
            }
        </ul>
    </div>
    @if (Model.Basket != null && Model.Basket.Any())
    {
        <div class="basket-footer">
            <div class="row total">
                <div class="col-xs-4">
                    <div class="text-center">
                        <span class="total-items">@Model.Quantity</span> @L("件")
                    </div>
                </div>
                <div class="col-xs-8">
                    <div class="clearfix">
                        <div class="text-right">
                            @L("总计")
                            <span class="price">
                                @L("￥")<span class="total -price">@Model.Total.ToString("F2")</span>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
            <a class="ckeck-out">@L("结 算")</a>
        </div>
    }    
</div>
